package com.yungu.swift.assets.passenger.dao;


import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yungu.swift.assets.passenger.model.dto.PassengerDto;
import com.yungu.swift.assets.passenger.model.vo.PassengerSimpleInfoVo;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.base.mapper.IMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * 乘客业务Mapper
 *
 * @author cuixiuyin - Generate
 * @version 1.1.1-SNAPSHOT
 * @since 2018-07-02 11:20
 */
public interface PassengerMapper extends IMapper<PassengerDto> {

    /**
     * 查询扩展
     *
     * @param map Map
     * @return List<PassengerDto>
     */
    List<PassengerDto> listExtend(Map<String, Object> map);

    /**
     * 后台查询list
     *
     * @param params Map
     * @return List<PassengerDto>
     */
    List<PassengerDto> listExport(Map<String, Object> params);

    /**
     * 优惠券预估乘客
     *
     * @param map Map
     * @return List<PassengerDto>
     */
    List<PassengerDto> estimate(Map<String, Object> map);

    /**
     * 根据用户ID获取钱包信息，主要包括账户余额，优惠券张数
     *
     * @param map Map
     * @return Map
     */
    Map<String, Object> getWallet(Map<String, Object> map);

    /**
     * 获取乘客uuids
     *
     * @param params Map
     * @return List<String>
     */
    List<String> getUuids(Map<String, Object> params);

    /**
     * 获取乘客uuids
     *
     * @param mobiles String[]
     * @return List<String>
     */
    List<String> getUuidsByMobiles(String[] mobiles);

    /**
     * 后台查询出领取过该礼包的用户
     *
     * @param map        Map
     * @param pageBounds PageBounds
     * @return PageList<PassengerDto>
     */
    PageList<PassengerDto> queryDrawPage(Map map, PageBounds pageBounds);

    /**
     * getSleepPassengerUuids
     *
     * @return List<String>
     */
    List<String> getSleepPassengerUuids(@Param("unusedDays") Integer unusedDays);

    /**
     * 根据用户token修改用户信息
     * passengerDto
     *
     * @return Boolean
     */
    Boolean editByToken(PassengerDto passengerDto);

    /**
     * 查询高频用户
     *
     * @return List<String>
     */
    List<String> getHighFrequencyPassengerUuids(@Param("highFrequencyDays") Integer highFrequencyDays, @Param("highFrequencyNum") Integer highFrequencyNum);

    /**
     * 根据乘客uuid获取对应的mobile
     *
     * @param passengerUuids List
     * @return List<PassengerDto>
     */
    List<PassengerDto> getPassengerByUuids(List<String> passengerUuids);

    @Update("update t_passenger set order_count=(order_count+1) where uuid=#{uuid}")
    void incrPasOrderCountByUuid(@Param("uuid") String passengerUuid);

    @Select("select uuid,mobile from t_passenger where uuid=#{uuid}")
    PassengerSimpleInfoVo queyrSimpleInfoById(@Param("uuid") String uuid);
}
